package com.coder.oj.admin.controller;

import com.coder.oj.common.core.JwtToken;
import com.coder.oj.common.core.R;
import com.coder.oj.common.utils.QiniuUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = {"文件管理"})
@RestController
@RequestMapping("/file")
public class FileController {

    @JwtToken
    @PostMapping("/upload")
    @ApiOperation("上传文件")
    public R upload(MultipartFile file) {
        QiniuUtil.upload(QiniuUtil.convert(file), "test");
        return R.ok();
    }
}
